home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-03-15 | 2.3 KB | 46 lines | [TEXT/CWIE] |
- /* LaunchMe
-
- This application and code resource will launch an application without a running application
- needing to call LaunchApplication. This is useful for applications that need to launch
- another application, but due to fact that there isn't enough currently free memory can't.
-
- When you call LaunchApplication() there has to be enough free memory to launch that
- application at the time of the call. It doesn't matter that LaunchApplication() isn't
- going to launch that application until someone calls GetNextEvent, by which time that
- memory might be free.
-
- This sample is meant to combat that problem. It shows you how to install a Time Manager
- task which will install a Notification Manager task which will call LaunchApplication on
- an application which was selected while the original application was running.
-
- You cannot call LaunchApplication() from a Time Manager task, but you can from a
- Notification Manager task. However, you can't install a working Notification Manager
- task and then quit your application because the notification will never get called (which
- is probably a good thing).
-
- The Time Manager doesn't have such a restriction making it the perfect candidate for this
- little hack.
-
- Your application would set up the structure needed to tell the Notification Manager task
- what application to launch, it would then post the Time Manager task and quit. You can
- adjust the delay time to suite your exit time, it is currently 1 second (1000 milliseconds).
-
- Once your application quits there should be enough memory to launch the new application and
- the user never knows anything strange happened. If there still isn't enough memory to
- launch the other application there is no (easy) way to tell the user since your application
- has quit and there is no one to post a dialog. For this reason you should do a preflight
- check to be reasonably certain that the launch will succeed.
-
- The Notification Manager task removes the Time Manager task and itself, so this should
- not leak any precious memory.
-
- This is built as 68K code which considerably simplifies things, and there won't be much
- if any speed decrease over a PowerPC version.
-
- If you have any bug reports or comments on how this could be improved, please let me know
- at mcookson@apple.com.
-
- Mark Cookson
- Developer Technical Support
- Apple Computer, Inc.
- */